﻿using Nemerle.Collections;
using Nemerle.Text;
using Nemerle.Utility;

using System;
using System.Collections.Generic;
using System.Linq;

namespace Nemerle2.Compiler
{
  /// <summary>
  /// Represent nemerle's a compile unit (file).
  /// </summary>
  [Record]
  public variant CompileUnit : PAst
  {
    | Content { RootNs  : PNamespace; GlobalAttrs : PCustomAttributes; }
    | Error   { Msg     : Msg; }

    public override ToString() : string
    {
      match (this)
      {
        | Content    => $"$Location CompileUnit"
        | Error(msg) => msg.ToString()
      }
    }
  }
}
